/* Copyright 2018 The Chromium Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file. */

@import url(omnibox_output_column_widths.css);

:host {
  --header-color: #555;
  display: inline-block;
}

/* detail section */

output-results-details {
  margin-bottom: 15px;
}

/* table */

table {
  --header-bg-color: #fafafa;
  --row-hover-color: #f5f5f5;

  background-color: white;
  border: 1px solid var(--border-color);
  border-spacing: 0;
  table-layout: fixed;
  width: 100%;
}

.head tr {
  background-color: var(--header-bg-color);
  color: var(--header-color);
  font-size: .875rem;
}

.body tr {
  /* sufficient to display 4 lines at 14px with 5px vert padding */
  height: 66px;
}

.body td > * {
  display: block;
  max-height: 56px;
}

.body tr.thin {
  /* sufficient to display 2 lines at 14px with 5px vert padding */
  height: 38px;
}

.body tr.thin td > * {
  max-height: 28px;
}

.body tr.expanded {
  height: 200px;
}

.body tr.expanded td > * {
  max-height: 190px;
}

.body td {
  white-space: pre-wrap;
  word-break: break-all;
}

.body td * {
  overflow: hidden;
}

.body td.elided:not(:hover) {
  white-space: pre;
}

.body td:not(:hover) * {
  text-overflow: ellipsis;
}

.body td:hover * {
  overflow-y: auto;
}

.body tr td pre.json {
  margin: 0;
  white-space: pre-wrap;
}

.body tr.thin:nth-child(even) {
  background-color: #fafafa;
}

.body tr:hover,
/* must explicitly select .thin tr's to override above .thin styling */
.body tr.thin:hover {
  background-color: var(--row-hover-color);
}

td {
  padding: 0 5px;
  transition: background-color 300ms;
}

th {
  padding: 11px 5px 5px;
  text-align: start;
}

tbody.head th {
  border-top: 1px solid var(--border-color);
}

.header-container {
  display: block;
  overflow: hidden;
  padding-bottom: 1px;
  padding-top: 1px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-container span:not(:last-child)::after {
  color: #555;
  content: ' & ';
}

.body:not(:first-of-type) td.cell-provider-and-type .pair-item:first-child {
  font-size: 0;
}

/* specific headers */

.header-provider-and-type .header-container :first-child {
  color: green;
}

.header-contents-and-description .header-container :nth-child(3) {
  color: orange;
}

.header-destination-url .header-container :first-child {
  color: blue;
}

.header-destination-url .header-container :nth-child(2) {
  color: red;
}

.header-fill-and-inline .header-container :nth-child(2) {
  border: 1px solid;
}

/* specific columns */

.pair-container {
  align-items: center;
}

.cell-provider-and-type .pair-item:first-child {
  color: green;
  font-weight: bold;
}

.cell-contents-and-description .pair-container,
.cell-destination-url .pair-container,
.cell-fill-and-inline .pair-container {
  display: flex;
  flex-wrap: wrap;
}

.cell-contents-and-description .pair-container,
.cell-destination-url .pair-container {
  margin-inline-end: -15px;
}

.cell-contents-and-description .pair-item,
.cell-destination-url .pair-item {
  margin-inline-end: 15px;
}

.cell-contents-and-description img.pair-item {
  border-radius: 3px;
  height: 28px;
}

.cell-contents-and-description .pair-item.contents::after {
  color: #555;
  content: '-';
  margin-inline-start: 15px;
}

.cell-contents-and-description .style-url {
  color: blue;
}

.cell-contents-and-description .style-match {
  font-weight: bold;
}

.cell-contents-and-description .style-dim {
  background: #eee;
}

.cell-contents-and-description .pair-item.answer {
  color: orange;
}

.cell-contents-and-description .pair-item.image-url {
  font-size: .5rem;
}

.cell-destination-url .pair-item:first-child img {
  margin-inline-end: 5px;
  vertical-align: middle;
}

.cell-destination-url .pair-item:nth-child(2) {
  color: red;
}

.cell-fill-and-inline .pair-container {
  margin-inline-end: -1px;
}

.cell-fill-and-inline .pair-item {
  margin-inline-end: 1px;
}

.cell-fill-and-inline .pair-item:nth-child(2):not(:empty) {
  border: 1px solid;
  font-weight: bold;
}

.cell-fill-and-inline .overlap-warning {
  color: red;
}

.cell-additional-info a {
  /* Inlined version of cr:file-download icon */
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" height="24" width="24"><path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"></path></svg>');
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  display: block;
  height: 16px;
  width: 16px;
}

.cell-additional-info:not(:hover) a {
  visibility: hidden;
}

/* boolean cells */

.check-mark,
.x-mark {
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  height: 16px;
  width: 16px;
}

.check-mark {
  background-image: url(chrome://resources/images/check_circle_green.svg);
}

.x-mark {
  background-image: url(chrome://resources/images/cancel_red.svg);
}

/* json cells */

pre.json .key {
  color: purple;
  font-weight: bold;
}

pre.json .string {
  color: green;
}

pre.json .number {
  color: blue;
}

pre.json .boolean {
  color: slateblue;
  font-weight: bold;
}

pre.json .null {
  color: magenta;
  font-weight: bold;
}

/* misc cells */

img:not([src]),
.pair-item:empty:not(img) {
  display: none;
}

/* filter */

.body tr.filtered-highlighted:not(:hover) {
  background-color: rgb(208, 240, 255);
}

.body tr.filtered-highlighted:not(:hover) td.filtered-highlighted-nested {
  background-color: rgb(208, 255, 208);
}
